package com.yituo.mjworld.mvc.entity.rule;

import com.yituo.mjworld.core.annotation.Rules;
import com.yituo.mjworld.core.web.core.BaseForm;

import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Id;
import java.util.Date;

/**
 * 省级代理的增加或者修改的表单
 */
public class ProAgent extends BaseForm {

  @Rules(id = true)
  public String id;
  @Rules(fieldName = "帐号")
  public String account;
  @Rules(fieldName = "密码")
  public String password;
  @Rules(fieldName = "昵称")
  public String nickname;
  @Rules(fieldName = "微信ID", required = false)
  public String wxId;
  @Rules(fieldName = "头像", required = false)
  public String headImage;
  @Rules(fieldName = "手机号码", required = false)
  public String telphone;
  @Rules(fieldName = "邮箱", required = false)
  public String email;
  public String erCodeUrl;
  public String orangeKey;
  public Date registerDate;
  public Date lastLoginDate;
  public int rule;
  @Rules(fieldName = "比率", required = false)
  public double scale;
  public String referrer;


  @Id
  @Column(name = "id", nullable = false, length = 36)
  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  @Basic
  @Column(name = "account", nullable = false, length = 50)
  public String getAccount() {
    return account;
  }

  public void setAccount(String account) {
    this.account = account;
  }

  @Basic
  @Column(name = "password", nullable = false, length = 50)
  public String getPassword() {
    return password;
  }

  public void setPassword(String password) {
    this.password = password;
  }

  @Basic
  @Column(name = "nickname", nullable = false, length = 50)
  public String getNickname() {
    return nickname;
  }

  public void setNickname(String nickname) {
    this.nickname = nickname;
  }

  @Basic
  @Column(name = "wxId", nullable = false, length = 50)
  public String getWxId() {
    return wxId;
  }

  public void setWxId(String wxId) {
    this.wxId = wxId;
  }

  @Basic
  @Column(name = "headImage", nullable = false, length = 50)
  public String getHeadImage() {
    return headImage;
  }

  public void setHeadImage(String headImage) {
    this.headImage = headImage;
  }

  @Basic
  @Column(name = "telphone", nullable = false, length = 11)
  public String getTelphone() {
    return telphone;
  }

  public void setTelphone(String telphone) {
    this.telphone = telphone;
  }

  @Basic
  @Column(name = "email", nullable = false, length = 50)
  public String getEmail() {
    return email;
  }

  public void setEmail(String email) {
    this.email = email;
  }

  @Basic
  @Column(name = "erCodeUrl", nullable = false, length = 50)
  public String getErCodeUrl() {
    return erCodeUrl;
  }

  public void setErCodeUrl(String erCodeUrl) {
    this.erCodeUrl = erCodeUrl;
  }

  @Basic
  @Column(name = "orangeKey", nullable = false, length = 50)
  public String getOrangeKey() {
    return orangeKey;
  }

  public void setOrangeKey(String orangeKey) {
    this.orangeKey = orangeKey;
  }

  @Basic
  @Column(name = "registerDate", nullable = false)
  public Date getRegisterDate() {
    return registerDate;
  }

  public void setRegisterDate(Date registerDate) {
    this.registerDate = registerDate;
  }

  @Basic
  @Column(name = "lastLoginDate", nullable = false)
  public Date getLastLoginDate() {
    return lastLoginDate;
  }

  public void setLastLoginDate(Date lastLoginDate) {
    this.lastLoginDate = lastLoginDate;
  }

  @Basic
  @Column(name = "rule", nullable = false)
  public int getRule() {
    return rule;
  }

  public void setRule(int rule) {
    this.rule = rule;
  }

  @Basic
  @Column(name = "scale", nullable = false, precision = 0)
  public double getScale() {
    return scale;
  }

  public void setScale(double scale) {
    this.scale = scale;
  }

  @Basic
  @Column(name = "referrer", nullable = false, precision = 0)
  public String getReferrer() {
    return referrer;
  }

  public void setReferrer(String referrer) {
    this.referrer = referrer;
  }

  @Override
  public int hashCode() {
    int result;
    long temp;
    result = id != null ? id.hashCode() : 0;
    result = 31 * result + (account != null ? account.hashCode() : 0);
    result = 31 * result + (password != null ? password.hashCode() : 0);
    result = 31 * result + (nickname != null ? nickname.hashCode() : 0);
    result = 31 * result + (wxId != null ? wxId.hashCode() : 0);
    result = 31 * result + (headImage != null ? headImage.hashCode() : 0);
    result = 31 * result + (telphone != null ? telphone.hashCode() : 0);
    result = 31 * result + (email != null ? email.hashCode() : 0);
    result = 31 * result + (erCodeUrl != null ? erCodeUrl.hashCode() : 0);
    result = 31 * result + (orangeKey != null ? orangeKey.hashCode() : 0);
    result = 31 * result + (registerDate != null ? registerDate.hashCode() : 0);
    result = 31 * result + (lastLoginDate != null ? lastLoginDate.hashCode() : 0);
    result = 31 * result + rule;
    temp = Double.doubleToLongBits(scale);
    result = 31 * result + (int) (temp ^ (temp >>> 32));
    return result;
  }

  @Override
  public boolean validate() {
    return defaultValidate();
  }
}
